<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE>
    <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>上传企业头像</title>
<script type="text/javascript">
$(function(){
	//当点击"选择按钮"时,调用该函数
	$("#bt_select").click(function() {
		$("#imageFile").click();
	});
	//如果图片改变，该form就提交
	$("#imageFile").bind("change", function() {
		if ($(this).val()) {
			$("#fileUpload").submit();
		}
	});
		});
window.uploadCallback = function(fileName) {
	
	var imgUrl = $("#showImageUrl").val();
	$("#bt_image").attr("src", imgUrl + "?fileName=" + fileName);
	var str=fileName.split("/");
	var name=str[str.length-1];
	$("#imageUrl").val(name);
};
</script>
</head>
<body>
<iframe name="hiddenFrame" style="display: none"></iframe>
<div style="display: none">
<form action="<%=basePath %>adm/upload_fileupload" id="fileUpload" method="post" enctype="multipart/form-data" target="hiddenFrame" >   
         请选择需要上传的文件：<input type="file" id="imageFile" name="file"/><br />  
     </form> 
     </div>
<div style="width: 170px;height: 150px;">
<div style="width: 170px;height: 30px;float: left">
<input type="button" value="上传头像" style="width:150px;height: 30px;font-family: 'Microsoft YaHei';font-size: 15px;" id="bt_select" />
</div>
<div style="width: 150px;height: 100px;border: #A9A9A9 1px dashed;float: left">
<img style="width: 150px; height: 100px;border: 0px;" id="bt_image" border="1px"></img>
</div>
</div>
    <!-- <input type="text" id="imageUrl"/> -->
	
	
	<!-- 显示图片的url，将图片的名称传给它，它就可以读取到对应的图片 -->
	<input type="hidden" id="showImageUrl" value="<%=basePath %>adm/upload_showImage" />
</body>
</html>